package com.briup.jz.web.controller;

import java.util.List;

import javax.validation.constraints.NotNull;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.briup.jz.bean.AccountApply;
import com.briup.jz.service.IJzAccountApplyService;
import com.briup.jz.utils.Message;
import com.briup.jz.utils.MessageUtil;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;


@Api(description="账户变动申请表相关接口")
@Validated
@RestController
@RequestMapping("/accountApply")
public class AccountApplyController {
    @Autowired
    private IJzAccountApplyService  jzAccountApplyService;  
    
    @ApiOperation(value = "查询所有资讯分类")
    @GetMapping("query")
    public Message query(Double money){
        List<AccountApply> list = jzAccountApplyService.query(money);
        return MessageUtil.success(list);
    }
    @ApiOperation(value = "通过id删除")
    @GetMapping("deleteById")
    @ApiImplicitParams({
    @ApiImplicitParam(name="id",value = "主键",paramType = "query", required=true),
    })
    public Message deleteById(@NotNull Long id){
    	jzAccountApplyService.deleteById(id);
        return MessageUtil.success("删除成功");
    }
    @ApiOperation(value = "保存或更新资讯分类信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name="id",value = "主键",paramType = "form"),
            @ApiImplicitParam(name="money",value = "提现金额",paramType = "form"),
            @ApiImplicitParam(name="applyType",value = "申请时间",paramType = "form"),
            @ApiImplicitParam(name="reason",value = "理由",paramType = "form"),
            @ApiImplicitParam(name="userId",value = "用户id",paramType = "form"),
            @ApiImplicitParam(name="applyTime",value = "申请时间",paramType = "form"),
            @ApiImplicitParam(name="status",value = "状态",paramType = "form"),
    })
    @PostMapping("saveOrUpdate")
    public Message saveOrUpdate(AccountApply account){
    	jzAccountApplyService.saveOrUpdate(account);
        return MessageUtil.success("更新成功");
    }
 
	
}
